package com.xinke.juc.case03;

import com.xinke.juc.util.Sleeper;
import lombok.extern.slf4j.Slf4j;

/**
 * @Author：xinke
 * @Date：2025/10/1
 * @Desc:
 */
@Slf4j
public class TestBrewTea {
    public static void main(String[] args) {
        Thread t1 = new Thread(() -> {
            log.info("洗茶壶");
            Sleeper.sleep(1);
            log.info("烧开水");
            Sleeper.sleep(5);
        }, "老王");

        Thread t2 = new Thread(() -> {
            log.info("洗茶壶");
            Sleeper.sleep(1);
            log.info("洗茶杯");
            Sleeper.sleep(2);
            log.info("拿茶叶");
            Sleeper.sleep(1);
            try {
                t1.join();
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
            log.info("泡茶");
        }, "小王");
        t1.start();
        t2.start();
    }
}
